<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>考神驾到手机我的错题</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/public.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/windowsheight.js"></script>

    <script src="${pageContext.request.contextPath}/manager_page/layui/layui.js"></script>
</head>

<body>
<input type="hidden" id="did_class_hidden" value="${param.did_class_hidden}">
<!-----------头部开始--------------->
<%@ include file="page_head.jsp"%>
<!-----------头部结束--------------->
<!-----------内容开始--------------->
 <div class="content">
   <div class="newdetailcon">
         <div class="biaoti"><img src="images/libg_06.jpg"><span id="did_class">我的错题</span></div>
       </div>
   <div class="errors_change">
       <ol class="newsin" id="did_ol">
<%--         <li><p>(1)</p><a href="chaptertest.jsp"><span>1.</span>题库标题<b>（125题）</b></a></li>--%>
<%--         <li><p>(22)</p><a href="chaptertest.jsp"><span>2.</span>题库标题<b>（125题）</b></a></li>--%>
<%--         <li><p>(333)</p><a href="chaptertest.jsp"><span>3.</span>题库标题<b>（125题）</b></a></li>--%>
<%--         <li><p>(33)</p><a href="chaptertest.jsp"><span>4.</span>题库标题<b>（125题）</b></a></li>--%>
<%--         <li><p>(4)</p><a href="chaptertest.jsp"><span>5.</span>题库标题<b>（125题）</b></a></li>--%>
    </ol>
   </div>

     <div class="pageturn">
         <div class="prepage"><a href="javascript:lastPage();">&lt; 上一页</a></div>
         <p><span><b id="current_page">1</b>/2</span></p>
         <div class="prepage"> <a href="javascript:nextPage();">下一页 &gt;</a></div>
     </div>
 </div>
 <!-----------内容结束--------------->
 <div class="footer">
   <p>©考神驾到版权所有</p>
   <span>www.kaoshenjiadao.com</span>
 </div>
 
</body>

<script>
    var layer;
    layui.use('layer',function (){
        layer=layui.layer;
    })

    var did_class=$("#did_class_hidden").val();
    $("#page_head_title").text("我的"+did_class);
    $("#did_class").text("科一"+did_class);

    window.onload=function(){
        changeDid_ol('科一');
    }
    function changeDid_ol(question_class){
        if(did_class=="收藏"){
            //收藏
            $.ajax({
                url:"${pageContext.request.contextPath}/front_collect/init_collect_chapter.do",
                data:{
                    "question_class":question_class
                },
                success:function (data,status){
                    if(status=="success"){
                        $("#did_ol").empty();
                        if(data.length==0){
                            $("#did_ol").text("暂无收藏");
                        }else {
                            for (var i = 0; i < data.length; i++) {
                                var li = $("<li></li>");
                                var p = $("<p></p>").text("(" + data[i].collect_num + ")");
                                var a = $("<a></a>").attr("href", "javascript:to_chaptertest(+" + data[i].question_chapter.substring(0, 1) + ");");
                                var span = $("<span></span>").text(data[i].question_chapter);
                                a.append(span);
                                li.append(p, a);
                                $("#did_ol").append(li);
                            }
                        }
                    }
                }
            })
        }else{
            //错题
            $.ajax({
                url:"${pageContext.request.contextPath}/front_collect/init_wrong_chapter.do",
                data:{
                    "question_class":question_class
                },
                success:function (data,status){
                    if(status=="success"){
                        $("#did_ol").empty();
                        if(data.length==0){
                            $("#did_ol").text("暂无错题");
                        }else {
                            for (var i = 0; i < data.length; i++) {
                                var li = $("<li></li>");
                                var p = $("<p></p>").text("(" + data[i].wrong_num + ")");
                                var a = $("<a></a>").attr("href", "javascript:to_chaptertest(+" + data[i].question_chapter.substring(0, 1) + ");");
                                var span = $("<span></span>").text(data[i].question_chapter);
                                a.append(span);
                                li.append(p, a);
                                $("#did_ol").append(li);
                            }
                        }
                    }
                }
            })

        }
    }

    function to_chaptertest(chapter_num){
        var question_class="科一";
        if(parseInt($("#current_page").text())==2){
            question_class="科四";
        }
        window.location.href="chaptertest.jsp?question_class_hide="+question_class+"&question_chapter_hide="+chapter_num
        +"&did_class="+did_class;
    }

    function lastPage(){
        var current_page=parseInt($("#current_page").text());
        if(current_page<=1){
            layer.msg("这已经是第一页了")
        }else{
            current_page--;
            $("#current_page").text(current_page);
            changeDid_ol('科一');
            $("#did_class").text("科一"+did_class);
        }
    }

    function nextPage(){
        var current_page=parseInt($("#current_page").text());
        if(current_page>=2){
            layer.msg("这已经是最后一页了")
        }else{
            current_page++;
            $("#current_page").text(current_page);
            changeDid_ol('科四');
            $("#did_class").text("科四"+did_class);
        }
    }

</script>










<!--头部高度赋给列表的topjs-->
<script>
   var heighttop=$(".top").height();
   $(".topmenu").css("top",heighttop);
    $(".menumore").toggle(function(){
	     $(".topmenu").show(); 
	   },function(){
	     $(".topmenu").hide(); 
	 	   })
   $(".buttontop").click(function(){
	     $(".topmenu").hide();  
	   })
	   
 $(function(){
	 $(".tasecartop span a").click(function(){
		  var $banktip=$(this).attr("tip");
		  $($banktip).show().siblings().hide();
		  $(".tasecartop span a").removeClass("payaclik");
		  $(this).addClass("payaclik");
		 })
	
	})
	/*模拟考试列表分类车型选择tab切换*/
 $(function(){
	 $(".test_onelist li a").click(function(){
		  var $banktip=$(this).attr("tip");
		  $($banktip).show().siblings().hide();
		  $(".test_onelist li a").removeClass("testcaraclick");
		  $(this).addClass("testcaraclick");
		 })
	
	})
	
 </script>
 
<!--头部高度赋给列表的topjs-->
<!--banner将图片的高度赋给父级扪js-->
<script>
   var heighta=$("#incltialiu li:eq(0) img").height();
   $(".main,.width,#incltialiu").height(heighta) ;
 </script>
 <!--banner将图片的高度赋给父级扪js-->
<!--首页标题点击出现更多分类js-->
 <script>
	$(".titlemore").toggle(function(){
		$(this).parent(".tabtila").siblings(".moresort").show()
		$(this).children("img").attr("src","images/title_692.jpg")
		},function(){
		$(this).parent(".tabtila").siblings(".moresort").hide()
		$(this).children("img").attr("src","images/title_69.jpg")
		})
  </script>
 <!--首页标题点击出现更多分类js-->
</html>
